package com.hantanger.weblog.controller;

import java.util.logging.Logger;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.hantanger.weblog.util.BlogPing;
import com.hantanger.weblog.util.HtmlUtil;

/**
 * 定时任务
 * @author lys
 *
 */
public class TaskController extends BaseController {
	
	private static final Logger log = Logger.getLogger(TaskController.class.getName());

	@Override
	public String doGet(HttpServletRequest request, HttpServletResponse response) {
		log.info("task");
		String type = HtmlUtil.getString(request, "type", "");
		if(type.equalsIgnoreCase("blogping")){
			blogPing(request);
		}
		return null;
	}
	
	private void blogPing(HttpServletRequest request){
		String nickname = HtmlUtil.getString(request, "nickname", "");
		String blogUrl = HtmlUtil.getString(request, "blogUrl", "");
		String postUrl = HtmlUtil.getString(request, "postUrl", "");
		String rssUrl = HtmlUtil.getString(request, "rssUrl", "");
		BlogPing.sendPing(nickname, blogUrl, postUrl, rssUrl);
	}
	
	
	
}
